//
// Created by chaseaishang on 23-6-18.
//

#pragma once

#include "Csas_Engine/Renderer/VertexArray.h"

namespace CsasEngine {

    class OpenGLVertexArray : public VertexArray
    {
    public:
        OpenGLVertexArray();
        virtual ~OpenGLVertexArray();

        virtual void Bind() const override;
        virtual void Unbind() const override;

        virtual void AddVertexBuffer(const Ref<VertexBuffer>& vertexBuffer) override;
        virtual void SetIndexBuffer(const Ref<IndexBuffer>& indexBuffer) override;

        virtual const std::vector<Ref<VertexBuffer>>& GetVertexBuffers() const { return m_VertexBuffers; }
        virtual const Ref<IndexBuffer>& GetIndexBuffer() const { return m_IndexBuffer; }
    private:
        uint32_t m_RendererID;
        uint32_t m_VertexBufferIndex = 0;
        uint32_t m_BindingIndex=0;
        std::vector<Ref<VertexBuffer>> m_VertexBuffers;
        Ref<IndexBuffer> m_IndexBuffer;
        static uint32_t curr_bound_vertex_array;
    };



}
